struct ListNode* deleteNode(struct ListNode* head, int val){
    if(head->val == val) {  
        return head->next;
    }

    struct ListNode* pre = head;

    // 没找到待删除的节点，继续遍历查找
    while ((pre->next != NULL) && (pre->next->val != val)) {  
        pre = pre->next;
    }

    // 找到
    if(pre->next != NULL) {  
        pre->next = pre->next->next;
    }
    return head;
}

